package edu.uz.issilab.rdfserializer.interfaces;

import java.beans.Expression;
import java.beans.Statement;

/** RDFEncodeable objects support the textual serialization of Java objects.
 * 
 * Any given implementing class is a complementary alternative to
 * the <code>ObjectOutputStream</code> and can used to generate
 * a textual representation of a <em>JavaBean</em> in the same
 * way that the <code>ObjectOutputStream</code> can
 * be used to create binary representation of <code>Serializable</code>
 * objects. 
 * 
 * For more information see java.beans.Encoder and java.beans.XMLEncoder.
 *     
 *  
 *
 */
public interface RDFEncodeable {
	  
	
	
	  /**
	     * Sets the owner of this encoder to <code>owner</code>.
	     *
	     * @param owner The owner of this encoder.
	     *
	     * @see #getOwner
	     */
	    public void setOwner(Object owner);

	    /**
	     * Gets the owner of this encoder.
	     *
	     * @return The owner of this encoder.
	     *
	     * @see #setOwner
	     */
	    public Object getOwner();

	    /**
	     * Write an RDF representation of the specified object to the output.
	     *
	     * @param o The object to be written to the stream.
	     *
	     * @see RDFDecodeable#readObject
	     */
	    public void writeObject(Object o);

	    /**
	     * Records the Statement so that the Encoder will
	     * produce the actual output when the stream is flushed.
	     * <P>
	     * This method should only be invoked within the context
	     * of initializing a persistence delegate.
	     *
	     * @param oldStm The statement that will be written
	     *               to the stream.
	     * @see java.beans.PersistenceDelegate#initialize
	     */
	    public void writeStatement(Statement oldStm) ;


	    /**
	     * Records the Expression so that the Encoder will
	     * produce the actual output when the stream is flushed.
	     * <P>
	     * This method should only be invoked within the context of
	     * initializing a persistence delegate or setting up an encoder to
	     * read from a resource bundle.
	     * <P>
	     * For more information about using resource bundles with the
	     * XMLEncoder (by analogy to RDF), see 
	     * http://java.sun.com/products/jfc/tsc/articles/persistence4/#i18n
	     *
	     * @param oldExp The expression that will be written
	     *               to the stream.
	     * @see java.beans.PersistenceDelegate#initialize
	     */
	    public void writeExpression(Expression oldExp);
	    /**
	     * This method writes out the preamble associated with the
	     * RDF encoding if it has not been written already and
	     * then writes out all of the values that been
	     * written to the stream since the last time <code>flush</code>
	     * was called. After flushing, all internal references to the
	     * values that were written to this stream are cleared.
	     */
	    public void flush();	    

	    /**
	     * This method calls <code>flush</code>, writes the closing
	     * postamble and then closes the output stream associated
	     * with this stream.
	     */
	    public void close();

	
}
